package cn.marinda.spritefragment.data;

import cn.marinda.spritefragment.SpriteFragment;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class MessageData implements DataObject{
    /*
    Message.yml
     */
    private YamlConfiguration message = null;
    private String no_permission;
    private List<String> help = null;
    private String synthesisSuccess ;
    private String synthesisFail;
    private String depleteNoMoney;
    private String synthesisShortage;
    private String synthesisNoNumber;
    public MessageData(){
        help = new ArrayList<>();
        defaultConfig();
        defaultGetConfig();
    }

    @Override
    public YamlConfiguration getConfig() {
        return message;
    }

    @Override
    public void defaultConfig() {
        message = new YamlConfiguration();
        try {
            message.load(new File(SpriteFragment.plugin.getDataFolder(),"message.yml"));
        }catch(Exception e){
            e.printStackTrace();
        }
    }

    @Override
    public void defaultGetConfig() {
        setNo_permission(message.getString("no_permission"));
        setDepleteNoMoney(message.getString("depleteNoMoney"));
        setHelp(message.getStringList("help"));
        setSynthesisFail(message.getString("synthesisFail"));
        setSynthesisNoNumber(message.getString("synthesisNoNumber"));
        setSynthesisSuccess(message.getString("synthesisSuccess"));
        setSynthesisShortage(message.getString("synthesisShortage"));
    }

    public String getNo_permission() {
        return no_permission;
    }

    public void setNo_permission(String no_permission) {
        this.no_permission = no_permission;
    }

    public List<String> getHelp() {
        return help;
    }

    public void setHelp(List<String> help) {
        this.help = help;
    }

    public String getSynthesisSuccess() {
        return synthesisSuccess;
    }

    public void setSynthesisSuccess(String synthesisSuccess) {
        this.synthesisSuccess = synthesisSuccess;
    }

    public String getSynthesisFail() {
        return synthesisFail;
    }

    public void setSynthesisFail(String synthesisFail) {
        this.synthesisFail = synthesisFail;
    }

    public String getDepleteNoMoney() {
        return depleteNoMoney;
    }

    public void setDepleteNoMoney(String depleteNoMoney) {
        this.depleteNoMoney = depleteNoMoney;
    }

    public String getSynthesisShortage() {
        return synthesisShortage;
    }

    public void setSynthesisShortage(String synthesisShortage) {
        this.synthesisShortage = synthesisShortage;
    }

    public String getSynthesisNoNumber() {
        return synthesisNoNumber;
    }

    public void setSynthesisNoNumber(String synthesisNoNumber) {
        this.synthesisNoNumber = synthesisNoNumber;
    }

}
